WIP: StdTx: Better JSON support #391
Closed
+75
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been working on prototype of IBC txs in informalsystems/ibc-rs#52.
Tried to use this lib where I could, but had a few issues. It's possible I misunderstood how to use it, so please let me know if I'm doing something super wrong, but here's what I found:
To unblock my current work, I made a few changes here. I'm not sure exactly what the plans are with this crate, or if these changes make sense for it, but regardless I think Informal would be happy to maintain it, or something like it, in the ibc-rs.
The changes I made were:
Address
so it can be used in Msg types and properly bech32 encoded and decoded in JSON (I see the to_json_value methods but didn't quite figure out how to use them); one caveat here is thecosmos
prefix is hardcoded, will take more work to generalize that (maybe it should be a field in the Address?)With these changes, and the StdTx I defined in informalsystems/ibc-rs#52, I was able to create an unsinged StdTx JSON for an ibc message, sign it using gaiacli, unmarshal the signed JSON back into Rust, and then encode it as not-fully-correct Amino (that part's still a WIP).